import Vue from 'vue'

import Cookies from 'js-cookie'
import dataV from '@jiaminghi/data-view'
import '@/utils/rem'
Vue.use(dataV)
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import '@/assets/font_4449761_g0khypoohtf/iconfont.css' // a modern alternative to CSS resets
import '@/assets/font_4449761_g0khypoohtf/iconfont.js' // a modern alternative to CSS resets
// view组件库引入
// import ViewUIPlus from 'view-ui-plus'
// import 'view-ui-plus/dist/styles/viewuiplus.css'
// Vue.use(ViewUIPlus)

import BaiduMap from 'vue-baidu-map'
import Element from 'element-ui'
import './styles/element-variables.scss'
import '@fortawesome/fontawesome-free/css/all.min.css'
import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import i18n from './lang' // internationalization
import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import formValidate from './utils/formValidate' // 表单验证
import { isNull } from './utils/index' // 判空
import { download } from '@/utils/request'

import * as filters from './filters' // global filters
import * as echarts from 'echarts' //引入echarts
import moment from 'moment' //导入文件
Vue.prototype.$moment = moment //赋值使用
import 'echarts-gl'
import dayjs from 'dayjs'
Vue.prototype.$dayjs = dayjs
Vue.use(BaiduMap, {
  ak: process.env.VUE_APP_KEY, // 替换成你自己的百度地图开发密钥
})
Vue.prototype.$echarts = echarts //引入组件
import CustomComponents from '@/components/Icons/index.js'
import fullscreen from 'vue-fullscreen'
import appConfig from './assets/js/base.js'
Vue.prototype.appConfig = appConfig
Vue.use(fullscreen)

// fontawesome图标
Object.keys(CustomComponents).forEach((key) => Vue.use(CustomComponents[key]))

Vue.use(Element, {
  size: Cookies.get('size') || 'medium', // set element-ui default size
  i18n: (key, value) => i18n.t(key, value),
})

// 时间转化
Vue.filter('dateformat', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
  return moment(dataStr).format(pattern)
})

// register global utility filters
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key])
})
// 定义字典全局方法
Vue.prototype.dictList = function (code) {
  return store.getters.dicts[code]
}

Vue.prototype.formValidate = formValidate

Vue.config.productionTip = false
Vue.prototype.isNull = isNull
Vue.prototype.download = download
new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: (h) => h(App),
})
